<html>
<head><meta charset="utf-8"><title>unsized locals · general · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/index.html">general</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/unsized.20locals.html">unsized locals</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="157776297"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/unsized%20locals/near/157776297" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/unsized.20locals.html#157776297">(Feb 07 2019 at 13:30)</a>:</h4>
<blockquote>
<p>= help: the trait <code>std::marker::Sized</code> is not implemented for <code>dyn std::fmt::Display</code><br>
  = note: to learn more, visit &lt;<a href="https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait" target="_blank" title="https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait">https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait</a>&gt;<br>
  = note: all local variables must have a statically known size<br>
  = help: unsized locals are gated as an unstable feature</p>
</blockquote>
<p>that message would be more helpful if it told me how that feature gate is called...</p>



<a name="157776341"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/unsized%20locals/near/157776341" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/unsized.20locals.html#157776341">(Feb 07 2019 at 13:31)</a>:</h4>
<p>hm, seems to be <code>unsized_locals</code> but that does not help</p>



<a name="157811066"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/unsized%20locals/near/157811066" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/unsized.20locals.html#157811066">(Feb 07 2019 at 20:41)</a>:</h4>
<p><a href="https://doc.rust-lang.org/nightly/unstable-book/language-features/unsized-locals.html" target="_blank" title="https://doc.rust-lang.org/nightly/unstable-book/language-features/unsized-locals.html">https://doc.rust-lang.org/nightly/unstable-book/language-features/unsized-locals.html</a></p>



<a name="157811088"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/unsized%20locals/near/157811088" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/unsized.20locals.html#157811088">(Feb 07 2019 at 20:41)</a>:</h4>
<p>There's a number of restrictions. I'm guessing you are trying to return such a type</p>



<a name="157811100"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/unsized%20locals/near/157811100" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/unsized.20locals.html#157811100">(Feb 07 2019 at 20:41)</a>:</h4>
<blockquote>
<p>When turned on, you can have unsized arguments and locals</p>
</blockquote>



<a name="157843417"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/unsized%20locals/near/157843417" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/unsized.20locals.html#157843417">(Feb 08 2019 at 08:31)</a>:</h4>
<p>no, not returning, just unsizing in a local without a <code>Box</code></p>



<a name="157843467"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/unsized%20locals/near/157843467" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/unsized.20locals.html#157843467">(Feb 08 2019 at 08:32)</a>:</h4>
<p>but mostly the error message should really state the feature name, I think</p>



<a name="157843471"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/unsized%20locals/near/157843471" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/unsized.20locals.html#157843471">(Feb 08 2019 at 08:32)</a>:</h4>
<p>of course in this case that'd also be confusing because the error remains in place with the feature gate^^</p>



<a name="157843474"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/unsized%20locals/near/157843474" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/unsized.20locals.html#157843474">(Feb 08 2019 at 08:32)</a>:</h4>
<p>but it still tells you to enable "a" feature gate</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>